{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "bf64eca8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://pypi.corp.kuaishou.com/kuaishou/prod/+simple/\n",
      "Collecting PyPDF2\n",
      "  Downloading https://pypi.corp.kuaishou.com/root/pypi/%2Bf/e28/f902f2f0a1603/PyPDF2-1.26.0.tar.gz (77 kB)\n",
      "\u001b[K     |████████████████████████████████| 77 kB 9.9 MB/s  eta 0:00:01\n",
      "\u001b[?25hBuilding wheels for collected packages: PyPDF2\n",
      "  Building wheel for PyPDF2 (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for PyPDF2: filename=PyPDF2-1.26.0-py3-none-any.whl size=61085 sha256=74c487901b398bc4adeb27eea4ff576f1ce2e03bdd471d6d2247087922a2c4e6\n",
      "  Stored in directory: /Users/peishuaishuai/Library/Caches/pip/wheels/74/dc/ee/8db1caadf62a8a4dcbfadc64612636bb586383cb58fa7ec69a\n",
      "Successfully built PyPDF2\n",
      "Installing collected packages: PyPDF2\n",
      "Successfully installed PyPDF2-1.26.0\n"
     ]
    }
   ],
   "source": [
    "!pip install  PyPDF2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "90495538",
   "metadata": {},
   "outputs": [],
   "source": [
    "from PyPDF2 import PdfFileReader"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "500ce9c3",
   "metadata": {},
   "outputs": [],
   "source": [
    "baoli_reader = PdfFileReader(\"分期支付协议 (1).pdf\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "22c891a5",
   "metadata": {},
   "outputs": [],
   "source": [
    "baoli_fields = baoli_reader.getFields()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "bfb79e33",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict_keys(['contractNo', 'merchantEmail', 'merchantAddress', 'merchantCreditCode', 'legalPerson', 'idNo', 'item', 'moeny1', 'periods', 'money', 'serviceMoeny1', 'userAddress', 'userPhone', 'userEmail', 'merchantName', 'userName', 'serviceMoeny', 'yyyy', 'dd', 'mm', 'per1', 'serviceFee1', 'payDate1', 'payMoeny1', 'item1', 'per2', 'per3', 'per4', 'per5', 'per6', 'per7', 'per8', 'per9', 'per10', 'per11', 'per12', 'per13', 'per14', 'per15', 'per16', 'per17', 'per18', 'per19', 'per20', 'per21', 'per22', 'per23', 'per24', 'payDate2', 'payDate3', 'payDate4', 'payDate5', 'payDate6', 'payDate7', 'payDate8', 'payDate9', 'payDate10', 'payDate11', 'payDate12', 'payDate13', 'payDate14', 'payDate15', 'payDate16', 'payDate17', 'payDate18', 'payDate19', 'payDate20', 'payDate21', 'payDate22', 'payDate23', 'payDate24', 'payMoeny3', 'payMoeny2', 'payMoeny4', 'payMoeny5', 'payMoeny6', 'payMoeny7', 'payMoeny8', 'payMoeny9', 'payMoeny10', 'payMoeny11', 'payMoeny12', 'payMoeny13', 'payMoeny14', 'payMoeny15', 'payMoeny16', 'payMoeny17', 'payMoeny18', 'payMoeny19', 'payMoeny20', 'payMoeny21', 'payMoeny22', 'payMoeny23', 'payMoeny24', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9', 'item10', 'item11', 'item12', 'item13', 'item14', 'item15', 'item16', 'item17', 'item18', 'item19', 'item20', 'item21', 'item22', 'item23', 'item24', 'serviceFee2', 'serviceFee3', 'serviceFee4', 'serviceFee5', 'serviceFee6', 'serviceFee7', 'serviceFee8', 'serviceFee9', 'serviceFee10', 'serviceFee11', 'serviceFee12', 'serviceFee13', 'serviceFee14', 'serviceFee15', 'serviceFee16', 'serviceFee17', 'serviceFee18', 'serviceFee19', 'serviceFee20', 'serviceFee21', 'serviceFee22', 'serviceFee23', 'serviceFee24', 'Signature1', 'Signature2', '1633014082083NDGY2'])"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "baoli_fields.keys()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "f529e7da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2109302200000057-F'"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(baoli_fields[\"contractNo\"].values())[-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "231c49d2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'91441900MA53GD4FXD'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(baoli_fields[\"merchantCreditCode\"].values())[-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d0fc1662",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
